﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ShieldNet.Models
{
    public class SpamsObject
    {
        public int id { get; set; }
        public string msisdn { get; set; }
        public string spam_text { get; set; }
        public DateTime spam_datetime { get; set; }
        public int spam_group { get; set; }
        public string spam_purpose { get; set; }
        public string app_id { get; set; }
        public string os { get; set; }
        public string report_dev_id { get; set; }
        public string spam_datetime_format
        {
            get
            {
                return this.spam_datetime.ToString("yyyy/MM/dd HH:mm:ss");
            }
        }
    }

    public class SpamsInDayObject
    {
        public SpamsInDayObject()
        {
            SpamsObject = new List<SpamsObject>();
        }

        public List<SpamsObject> SpamsObject { get; set; }
        public int TotalDay { get; set; }
        public int Total { get; set; }
        public int MaxID
        {
            get
            {
                if(this.SpamsObject!=null && this.SpamsObject.Count>0)
                {
                    return this.SpamsObject.Max(p => p.id);
                }
                else
                {
                    return 0;
                }
            }
        }

        public string Message { get; set; }
    }

    public class TableSpams
    {
        public TableSpams()
        {
            total = 1;
            rows = new List<SpamsObject>();
        }
        public int total { get; set; }
        public List<SpamsObject> rows { get; set; }
    }
}